package com.jzbooks.exception;

import com.jzbooks.enums.ResultCodeEnum;
import lombok.Data;

/**
 * @author mingPeng
 * @date 2021/4/19 19:27
 * @Description : 自定义异常
 */
@Data
public class BusinessException extends RuntimeException{
    protected String message;

    protected Integer code;

    protected ResultCodeEnum resultCodeEnum;


    public BusinessException() {
    }

    public BusinessException(String message) {
        this();
        this.message = message;
    }


    public BusinessException(ResultCodeEnum resultCodeEnum) {
        this.resultCodeEnum = resultCodeEnum;
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMsg();
    }
}
